package wisp.gui;

//GTGE GUI
import com.golden.gamedev.gui.*;
import com.golden.gamedev.gui.toolkit.*;

//JFC
import java.util.*;
import java.math.*;
import java.awt.Color;

//wisp
import wisp.dataObjects.Statistics;
import wisp.game.PlayerSprite;



public class StatsWindow extends TFloatPanel {


	//changeable labels
	private TLabel hp_current;
	private TLabel mp_current;
	
	private TLabel level;
	private TLabel char_class;
	private TLabel char_title;
	private TLabel guild_name;
	
	private TLabel stat_perah;
	private TLabel stat_str;
	private TLabel stat_dex;
	private TLabel stat_int;
	private TLabel stat_vit;
	private TLabel stat_spr;
	
	private TLabel deriv_atkmin;
	private TLabel deriv_atkmax;
	private TLabel deriv_acc;
	private TLabel deriv_SPD;
	private TLabel deriv_crit;
	private TLabel deriv_range;
	private TLabel deriv_defense;
	private TLabel deriv_mobility;
	private TLabel deriv_dodge;
	private TLabel deriv_block;
	private TLabel deriv_resist;
	
	//TEMP SHiz
	private TLabel deriv_regenHP;
	private TLabel deriv_regenMP;
	
	//private float lineage_value;
	
	public StatsWindow(){
		super("Character Info", true, false, 5, 105, 150, 330);
		
		TLabel char_title = new TLabel("Title: ", 2, 2, 150, 10 );
		TLabel guild_name = new TLabel("Guild: ", 2, 12, 150, 10 );
		
		TLabel hp_label = new TLabel("HP: ", 2, 42, 150, 10 );
		TLabel mp_label = new TLabel("MP: ", 2, 52, 150, 10 );
		
		TLabel str_label = new TLabel("STR ", 2, 82, 150, 10 );
		TLabel dex_label = new TLabel("DEX ", 2, 92, 150, 10 );
		TLabel int_label = new TLabel("INT ", 2, 102, 150, 10 );
		TLabel vit_label = new TLabel("VIT ", 2, 112, 150, 10 );
		TLabel spr_label = new TLabel("SPR ", 2, 122, 150, 10 );
		
		TLabel acc_label = new TLabel("ACC ", 2, 142, 150, 10 );
		TLabel atk_label = new TLabel("ATK ", 2, 152, 150, 10 );
		TLabel spd_label = new TLabel("SPD ", 2, 162, 150, 10 );
		TLabel crit_label = new TLabel("CRIT ", 2, 172, 150, 10 );
		TLabel range_label = new TLabel("Range ", 2, 182, 150, 10 );
		
		TLabel armor_label = new TLabel("Defense ", 2, 202, 150, 10 );
		TLabel mobility_label = new TLabel("Mobility ", 2, 212, 150, 10 );
		TLabel block_label = new TLabel("Block ", 2, 222, 150, 10 );
		TLabel dodge_label = new TLabel("Dodge", 2, 232, 150, 10);
		TLabel resist_label = new TLabel("Resist ", 2, 242, 150, 10 );
		//
		//
		//
		hp_current = new TLabel("", 40, 42, 150, 10 );
		mp_current = new TLabel("", 40, 52, 150, 10 );
		
		stat_str = new TLabel("", 100, 82, 150, 10 );
		stat_dex = new TLabel("", 100, 92, 150, 10 );
		stat_int = new TLabel("", 100, 102, 150, 10 );
		stat_vit = new TLabel("", 100, 112, 150, 10 );
		stat_spr = new TLabel("", 100, 122, 150, 10 );
		
		deriv_acc = new TLabel("", 100, 142, 150, 10 );
		//deriv_atkmin = new TLabel("", 100, 152, 150, 10 );
		deriv_atkmax = new TLabel("", 100, 152, 150, 10 );
		deriv_SPD = new TLabel("", 100, 162, 150, 10 );
		deriv_crit = new TLabel("", 100, 172, 150, 10 );
		deriv_range = new TLabel("", 100, 182, 150, 10 );
		
		deriv_defense = new TLabel("", 100, 202, 150, 10 );
		deriv_mobility = new TLabel("", 100, 212, 150, 10 );
		deriv_block = new TLabel("", 100, 222, 150, 10 );
		deriv_dodge = new TLabel("", 100, 232, 150, 10);
		deriv_resist = new TLabel("", 100, 242, 150, 10 );
		
		deriv_regenHP = new TLabel("", 100, 262, 150, 10);
		deriv_regenMP = new TLabel("", 100, 272, 150, 10);
		
		
		
		this.add(char_title);
		this.add(guild_name);
		this.add(hp_label);
		this.add(mp_label);
		this.add(str_label);
		this.add(dex_label);
		this.add(int_label);
		this.add(vit_label);
		this.add(spr_label);
		this.add(acc_label);
		this.add(atk_label);
		this.add(spd_label);
		this.add(crit_label);
		this.add(range_label);
		this.add(armor_label);
		this.add(mobility_label);
		this.add(block_label);
		this.add(dodge_label);
		this.add(resist_label);
		//
		this.add(hp_current);
		this.add(mp_current);
		
		this.add(stat_str);
		this.add(stat_dex);
		this.add(stat_int);
		this.add(stat_vit);
		this.add(stat_spr);
		
		this.add(deriv_acc);
		//this.add(deriv_atkmin);
		this.add(deriv_atkmax);
		this.add(deriv_SPD);
		this.add(deriv_crit);
		this.add(deriv_range);
		
		this.add(deriv_defense);
		this.add(deriv_mobility);
		this.add(deriv_block);
		this.add(deriv_dodge);
		this.add(deriv_resist);
		//
		this.add(deriv_regenHP);
		this.add(deriv_regenMP);
		
		//expText.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);*/
		
		stat_dex.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		stat_int.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		stat_spr.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		stat_str.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		stat_vit.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		
		//deriv
		deriv_acc.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_atkmax.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_block.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_crit.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_defense.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_dodge.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_mobility.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_range.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_resist.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_SPD.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		
		//
		deriv_regenHP.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		deriv_regenMP.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);
		
		
		
	}
	
	public void updateStats(PlayerSprite p){
		
		String hp = ((Integer)p.getCurrentHP()).toString() + "/" + ((Integer)p.getMaxHP()).toString();
		String mp = ((Integer)p.getCurrentMP()).toString() + "/" + ((Integer)p.getMaxMP()).toString();

		//basic
		hp_current.setText(hp);
		mp_current.setText(mp);
		
		//base
		stat_dex.setText(((Integer)p.getStatistics().getDex()).toString());
		stat_int.setText(((Integer)p.getStatistics().getCInt()).toString());
		stat_spr.setText(((Integer)p.getStatistics().getSpr()).toString());
		stat_str.setText(((Integer)p.getStatistics().getStr()).toString());
		stat_vit.setText(((Integer)p.getStatistics().getVit()).toString());
		
		//deriv
		deriv_acc.setText(((Double)p.getStatistics().getARate()).toString() + "%");
		deriv_atkmax.setText(((Integer)p.getStatistics().getAtk()).toString());
		deriv_block.setText(((Double)p.getStatistics().getBRate()).toString() + "%");
		deriv_crit.setText(((Double)p.getStatistics().getCritRate()).toString() + "%");
		deriv_defense.setText(((Integer)p.getStatistics().getDef()).toString());
		deriv_dodge.setText(((Double)p.getStatistics().getDRate()).toString() + "%");
		deriv_mobility.setText(((Integer)p.getStatistics().getMobility()).toString());
		deriv_range.setText("N/A"); //!!!!!!!!!11
		deriv_resist.setText(((Integer)p.getStatistics().getRes()).toString());
		deriv_SPD.setText(((Double)p.getStatistics().getSpd()).toString());
		
		deriv_regenHP.setText(((Double)p.getStatistics().getHpGR()).toString() + "/sec");
		deriv_regenMP.setText(((Double)p.getStatistics().getMpGR()).toString() + "/sec");
		
		
		this.update();
		
	}
	
	
/*	/////////////////////////
	//exp
	TLabel expText = new TLabel("", 5, 35, 120, 40);
	String text5 = "exp";
	expText.setText(text5);
	expText.UIResource().put("Text Vertical Alignment Integer", UIConstants.TOP);
	expText.UIResource().put("Text Horizontal Alignment Integer", UIConstants.LEFT);*/
	
	//this.add(expText);
}
